<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .grid-container{
        display: grid;
        grid-template-rows: repeat(3, 100px);
        grid-template-columns: repeat(3, 100px);
        /* 默认值，先行后列 */
        /* grid-auto-flow: row;  */

        /* 先列后行 */
        grid-auto-flow: column;
    }

    .grid-item:nth-child(odd){
        background-color: skyblue;
    }

    .grid-item:nth-child(even){
        background-color: pink;
    }
</style>
<body>
    <!-- 
        TIP
        grid-auto-flow 属性决定了项目在容器中的排列顺序。是 “先行后列”，还是 “先列后行”
    -->

    <div class="grid-container">
        <div class="grid-item">1</div>
        <div class="grid-item">2</div>
        <div class="grid-item">3</div>
        <div class="grid-item">4</div>
        <div class="grid-item">5</div>
        <div class="grid-item">6</div>
        <div class="grid-item">7</div>
        <div class="grid-item">8</div>
        <div class="grid-item">9</div>
      </div>
</body>
</html>